package so.sao.code.service.infrastructure.jpa.convert;

import so.sao.code.service.infrastructure.enums.TAG_BATCH_TYPE;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

@Converter(autoApply = true)
public class TagBatchTypeConvert implements AttributeConverter<TAG_BATCH_TYPE, Integer> {

	@Override
	public Integer convertToDatabaseColumn(TAG_BATCH_TYPE attribute) {
		return attribute.getValue();
	}

	@Override
	public TAG_BATCH_TYPE convertToEntityAttribute(Integer dbData) {
		return TAG_BATCH_TYPE.fromValue(dbData);
	}

}
